//
//  LookDesignTableViewCell.m
//  WZYInteriorDesign
//
//  Created by lanou on 15/12/19.
//  Copyright (c) 2015年 lanou. All rights reserved.
//

#import "LookDesignTableViewCell.h"
#import "LookDesign.h"
#import "UIImageView+AFNetworking.h"
@implementation LookDesignTableViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        _coverImage = [[UIImageView alloc]initWithFrame:CGRectMake(15, 10, 345, 215)];
        _coverImage.backgroundColor = [UIColor redColor];
        [self.contentView addSubview:_coverImage];
        
        _personView = [[UIImageView alloc]initWithFrame:CGRectMake(15, 235, 80, 80)];
        _personView.backgroundColor = [UIColor grayColor];
        [self setImageLayer:_personView];
        [self.contentView addSubview:_personView];
        
        _titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(115, 250, 180, 20)];
        _titleLabel.font = [UIFont boldSystemFontOfSize:16.0];
        _titleLabel.textColor = [UIColor orangeColor];
        [self.contentView addSubview:_titleLabel];
        
        _addressLabel = [[UILabel alloc]initWithFrame:CGRectMake(115, 285, 200, 20)];
        _addressLabel.font = [UIFont systemFontOfSize:15.0];
        _addressLabel.textColor = [UIColor grayColor];
        [self.contentView addSubview:_addressLabel];
    }
    return self;
}

//重写model set方法
- (void)setLookDesign:(LookDesign *)lookDesign{
    if (_lookDesign != lookDesign) {
        _lookDesign = lookDesign;
        [self.coverImage setImageWithURL:[NSURL URLWithString:lookDesign.cover_pic]];
        [self.personView setImageWithURL:[NSURL URLWithString:lookDesign.author_face]];
        _titleLabel.text = lookDesign.title;
        _addressLabel.text = lookDesign.title_sub;
    }
}

//将人物图片设置为圆形
- (void)setImageLayer:(UIImageView *)imageView{
    imageView.layer.cornerRadius = imageView.bounds.size.height/2;
    imageView.layer.masksToBounds = YES;
    imageView.layer.borderWidth = 2;
    imageView.layer.borderColor = [[UIColor cyanColor]CGColor];
    
}











- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
